from selenium.webdriver.common.by import By


class VipLearnHomePageLocator:
    # 首页登录按钮
    login_btn_loc = (By.XPATH, "//button[text()='登录']")
    email_div_loc = (By.XPATH, "//div[text()='电子邮箱']")
    user_loc = (By.XPATH, '//input[@placeholder="请输入邮箱"]')
    login_div_loc = (By.XPATH, "//div[text()='登录']")
    # 勾选同意
    check_img_loc = (By.XPATH, "//img[contains(@src, 'icon_unSelected@2x.png')]")

    # ----搜索标签---
    # 来自哪个国家
    be_from_tab_loc = (By.XPATH, "//span[text()='来自']")
    course_type_tab_loc = (By.XPATH, "//span[text()='课程类型']")
    price_tab_loc = (By.XPATH, "//span[text()='价格']")
    price_range_loc = (By.XPATH, "//div[text()='10-50美元']")
    schooltime_tab_loc = (By.XPATH, "//span[text()='可上课时间']")

    be_from_tab_count_loc = (By.XPATH, "//span[text()='来自']/following-sibling::span")
    # tab选择后计数元素
    count_loc = (By.XPATH, "//span[text()='{}']/following-sibling::span")
    # 选择筛选项元素
    check_span = (By.XPATH, "//span[text()='{}' and not(contains(@class, 'hidden'))]")
    # 提交
    submit_loc = (By.XPATH, "//span[text()='提交']")

    # 列表标签
    list_loc = (By.TAG_NAME, "app-teacher-card")
    # miao老师
    teacher_name_loc = (By.XPATH, "//span[text()='Miao']")
    # Mr Guo
    teacher_name_MrGuo_loc = (By.XPATH, "//span[text()='Mr Guo']")

    vdieo_loc = (By.XPATH, "//video[@controlslist='nodownload']")

    # 教师名字搜索框
    search_teacher_name = (By.XPATH, "//input[@placeholder='教师名字']")
    search_img_loc = (By.XPATH, "//img[contains(@src, 'search.png') and contains(@class, 'cursor-pointer')]")
    # 清除所有
    clear_loc = (By.XPATH, "//span[text()='清除所有']")

    # -------列表-------
    list_num_loc = (By.XPATH, "//app-teacher-card[{}]")
    # 列表Mr Guo头像
    head_photo_mrguo_loc = (By.XPATH, "//div[@class='relative inline-block']//img[@src='https://img.viplearn.cn/f0ebc6d978c645c7b79e0d818f473c33.png']")
    list_teacher_from_loc = (By.XPATH, "//app-teacher-card[1]//p[text()='来自：中国']")
    list_teacher_ProfessorCourse_loc = (By.XPATH, "//app-teacher-card[1]//p[text()='教授：英语']")
    # 最低每小时费用
    list_teacher_hourly_loc = (By.XPATH, "//app-teacher-card[1]//p[text()='USD 1' and contains(@class, 'font-PF-ME')]")

    # 简介
    list_teacher_cv_loc = (By.XPATH, "//app-teacher-card[1]//div[text()='简介']")
    list_teacher_cv_content_loc = (By.XPATH, "//app-teacher-card[1]//span[contains(@class, 'break-words')]")
    list_teacher_calendar_loc = (By.XPATH, "//app-teacher-card[1]//div[text()='日历']")

    # 联系教师
    contact_teacher_loc = (By.XPATH, "//div[contains(@class, 'rounded')]//div[text()='联系教师']")
    # 环信
    app_chat_loc = (By.XPATH, "//app-chat")

    # -------------------预约课程--------------------------
    booking_class_loc = (By.XPATH, "//app-teacher-card[1]//button[text()='预约课程']")
    # 课表  bg-white空白， checked选中  bg-[#6DCA6E]可选
    # 日历可选开课时间
    curriculum_time_loc = (By.XPATH, "//td[contains(@class, 'bg-[#6DCA6E]') and contains(., '19:30-20:30')]")
    curriculum_time_loc = (By.XPATH, "//td[contains(@class, 'bg-[#6DCA6E]') and contains(., '{}')]")

    # 课程选择
    courses_loc = (By.XPATH, "//p[text()='这是一个测试用的课程名称']")
    courses_loc = (By.XPATH, '//p[text()="{}"]')
    # 课时
    lesson_loc = (By.XPATH, "//div[contains(@class, 'relative')]/p[text()='1个课时']/..")
    lesson_loc = (By.XPATH, "//div[contains(@class, 'relative')]/p[text()='{}']/..")
    lesson_loc = (By.XPATH, "//div[contains(., '30分钟') and contains(@class, 'mr-6')]//div[contains(@class, 'relative')]/p[text()='{}']/..")
    # 选择时间
    # 日历右翻页
    right_loc = (By.XPATH, "//tr//img[@src='assets/image/process/right.png']")
    # 日历时间所在行 19:30
    row_loc = (By.XPATH, "//td[text()='{}']")
    # 下一步
    next_loc = (By.XPATH, "//p[text()='下一步']")
    # 已被占用弹窗
    take_up_toast_loc = (By.XPATH, "//div[contains(., '已被占用')]")

    # 支付按钮
    pay_loc = (By.XPATH, "//span[text()=' 支付 ']")
    wechat_pay_loc = (By.XPATH, "//span[text()='微信']")
    wechat_checked_loc = (By.XPATH, "//span[text()='微信']/../img")
    # 消息--随便的定位，关闭微信支付二维码弹层用
    message_loc = (By.XPATH, "//span[text()='消息']")
    message_loc = (By.XPATH, "//div[@class='cdk-overlay-container']")
    # 微信付款二维码
    wechat_qrcode_loc = (By.XPATH, "//app-wechat-pay")
    # 关闭二维码付款按钮
    close_paying_loc = (By.XPATH, "//span[contains(@class, 'inline-flex')]")

    alipay_loc = (By.XPATH, "//span[text()='支付宝']")
    paypal_loc = (By.XPATH, "//span[text()='Paypal']")
    balance_loc = (By.XPATH, "//span[contains(text(), '可用余额')]")
    # 可用余额勾选状态
    balance_checked_loc = (By.XPATH, "//span[contains(text(), '可用余额')]/../img")
    # 可用余额支付后弹窗-继续约课按钮
    go_on_loc = (By.XPATH, "//div[text()='继续约课']")
    # 可用余额支付后弹窗-查看订单
    check_order_loc = (By.XPATH, "//div[text()='查看订单']")
    # 我的订单-等待-列表
    await_order_list_card = (By.XPATH, "//app-classpack-card")
    termination_order_loc = (By.XPATH, "//div[text()='终止订单']")
    # 终止订单弹窗确认按钮
    termination_affirm_loc = (By.XPATH, "//div[text()='确定']")

    # ——————————————————————头像列表区域——————————————————
    # 头像区域
    head_set_loc = (By.XPATH, "//div[@class='flex items-center cursor-pointer']")
    class_calendar_loc = (By.XPATH, "//span[text()='课表日历']")
    reservation_record_loc = (By.XPATH, "//span[text()='预约记录']")
    my_orders_loc = (By.XPATH, "//span[text()='我的订单']")
    my_wallet_loc = (By.XPATH, "//span[text()='我的钱包']")
    my_homepage_loc = (By.XPATH, "//span[text()='我的主页']")
    quit_loc = (By.XPATH, "//span[text()='退出']")
    # 跳转到功能页面的头部标识(预约记录和我的订单)
    subpage_head_loc = (By.XPATH, "//div[contains(@class, 'text-xl')]")
    # 跳转到功能页面的头部标识(我的钱包【我的点数】和我的主页【个人信息】)
    subpage_head2_loc = (By.XPATH, "//p[contains(@class, 'text-xl')]")
    # ——————————————————————————预约记录、我的订单————————————————————————
    all_tab_loc = (By.XPATH, "//div[text()='所有']")
    need_tab_loc = (By.XPATH, "//div[text()='需要操作']")
    await_tab_loc = (By.XPATH, "//div[text()='等待']")
    upcoming_tab_loc = (By.XPATH, "//div[text()='即将上课']")
    perform_tab_loc = (By.XPATH, "//div[text()='已完成']")
    cancel_tab_loc = (By.XPATH, "//div[text()='已取消']")
    no_reservation_tab_loc = (By.XPATH, "//div[text()='未预约']")
    terminate_tab_loc = (By.XPATH, "//div[text()='已终止']")
    # 预约记录列表
    reservation_card_loc = (By.XPATH, "//app-class-card")
    reservation_cards_loc = (By.XPATH, "//app-class-card/..")
    # 我的订单列表
    order_card_loc = (By.XPATH, "//app-classpack-card")
    order_cards_loc = (By.XPATH, "//app-classpack-card/..")

    # ——————————————————————————我的钱包页————————————————————————
    # 我的钱包页--搜索
    wallet_search_loc = (By.XPATH, "//button[1]")
    # 我的钱包页--重置
    wallet_reset_loc = (By.XPATH, "//button[2]")
    # 我的钱包页--选择交易类型
    dealType_select_loc = (By.XPATH, "//input[@placeholder='请输入交易类型']")
    # 我的钱包页-类型-- 购买点数、购买课时包消耗点数、取消课时包返还收费点数、取消课时包返还赠送点数、邀请活动奖励点数
    dealType_option_loc = (By.XPATH, "//app-option[@value='{}']")
    # 我的钱包页-交易详情-table数据
    deal_detail_tbody_loc = (By.XPATH, "//div[@class='overflow-hidden']/table/tbody")
    # 我的钱包页-交易详情-每夜数据条数选择框
    page_data_count_loc = (By.XPATH, "//input[@placeholder='请选择']")
    # 每页条数
    num_per_page_loc = (By.XPATH, "//app-option[@ng-reflect-value='40条/页']")

    # ——————————————————————————我的主页————————————————————————
    # 我的主页--个人信息-用户名
    pd_username_loc = (By.XPATH, "//i[text()='用户名']/following-sibling::em")
    # 我的主页--个人信息-邀请码(通过兄弟元素定位)
    pd_invitation_code_loc = (By.XPATH, "//i[text()='我的邀请码']/following-sibling::em")
    # 账号管理
    account_management_loc = (By.XPATH, "//span[text()=' 帐号管理 ']")
    # 我的主页--账号管理-电子邮箱
    am_email_loc = (By.XPATH, "//i[text()='电子邮箱']/following-sibling::em")
    # 我的主页--账号管理-手机号码
    am_mobile_loc = (By.XPATH, "//i[text()='手机号码']/following-sibling::em")

